package com.maiji.cloud.controller;

import com.maiji.cloud.request.BaseInputDto;
import com.maiji.cloud.request.IdInputDto;
import com.maiji.cloud.response.BaseOutPutDto;
import com.maiji.cloud.response.community.ComPraiseOutputDto;
import com.maiji.cloud.response.login.UserInfoResData;
import com.maiji.cloud.response.shopingmall.FinancialDetailsResData;
import com.maiji.cloud.service.ComPraiseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/community")
@Api(value = "论坛模块")
public class ComPraiseController {

    @Autowired
    ComPraiseService  praiseService;

    @PostMapping("/praiseList")
    @ApiOperation("点赞列表")
    public BaseOutPutDto<List<UserInfoResData>>praiseList(@RequestBody BaseInputDto<IdInputDto>inputDto){
        return praiseService.praiseList(inputDto);
    }


    @PostMapping("/praise")
    @ApiOperation("动态点赞")
    public BaseOutPutDto<FinancialDetailsResData> praise(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){

        return praiseService.praise(inputDto,maijiToken);
    }
    @PostMapping("/cancelPraise")
    @ApiOperation("取消动态点赞")
    public BaseOutPutDto<String> cancelPraise(@RequestBody BaseInputDto<IdInputDto> inputDto, @RequestHeader("maijiToken")String maijiToken){
        return praiseService.cancelPraise(inputDto,maijiToken);
    }
}
